/// @tags: DP KMP Matrix
#include <cstdio>
#include <cstring>
#include <iostream>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

constexpr int MAXM = 21;

int n, m, k;
int nxt[MAXM];
char str[MAXM];

struct Matrix;

struct Vector {
  static int n;
  int a[MAXM];

  Vector() { memset(a, 0, sizeof(a)); }

  inline int &operator[](int index) { return a[index]; }
  inline const int &operator[](int index) const { return a[index]; }

  Vector operator*(const Matrix &rhs) const;
} A;

struct Matrix {
  static int n;
  Vector a[MAXM];

  inline Matrix(int x = 0) {
    for (rint i = 0; i < n; ++i) a[i][i] = x;
  }

  inline Vector &operator[](int index) { return a[index]; }
  inline const Vector &operator[](int index) const { return a[index]; }

  Matrix operator*(const Matrix &rhs) const;
  Matrix operator^(int exp) const;
} T;

int Vector::n, Matrix::n;

inline Vector Vector::operator*(const Matrix &rhs) const {
  Vector res;
  for (rint i = 0; i < n; ++i)
    for (rint j = 0; j < n; ++j) (res[i] += a[j] * rhs[j][i]) %= k;
  return res;
}

inline Matrix Matrix::operator*(const Matrix &rhs) const {
  Matrix res;
  for (rint i = 0; i < n; ++i) res[i] = a[i] * rhs;
  return res;
}

inline Matrix Matrix::operator^(int exp) const {
  Matrix res(1), base(*this);
  for (; exp; exp >>= 1, base = base * base)
    if (exp & 1) res = res * base;
  return res;
}

inline void Kmp() {
  nxt[1] = 0;
  for (rint i = 2, j = 0; i <= m; ++i) {
    while (j && str[j + 1] != str[i]) j = nxt[j];
    if (str[j + 1] == str[i]) j++;
    nxt[i] = j;
  }
  for (rint i = 0; i < m; ++i) {
    for (rint j = '0'; j <= '9'; ++j) {
      rint tmp = i;
      while (str[tmp + 1] != j && tmp) tmp = nxt[tmp];
      if (str[tmp + 1] == j) tmp++;
      if (tmp < m) T[i][tmp]++;
    }
  }
}

inline int main() {
  cin >> n >> m >> k >> (str + 1);
  Kmp();
  Vector::n = Matrix::n = m;
  A[0] = 1;
  A = A * (T ^ n);
  int ans = 0;
  for (int i = 0; i < m; ++i) {
    if ((ans += A[i]) >= k) ans -= k;
  }
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P3193 [HNOI2008] GT考试.in", "r", stdin);
  freopen("P3193 [HNOI2008] GT考试.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
